package info.wangyuan.agent.controller.admin;

import info.wangyuan.agent.entity.dto.AddKnowledgeSourceDTO;
import info.wangyuan.agent.service.curd.KnowledgeSourceService;
import info.wangyuan.agent.utils.Result;
import org.springframework.web.bind.annotation.*;

/**
 * 知识源管理控制层
 *
 * @author Albert
 * @since 2025-07-20 20:04:07
 */
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("admin/knowledgeSource")
public class KnowledgeSourceController {

    private final KnowledgeSourceService knowledgeSourceService;

    public KnowledgeSourceController(KnowledgeSourceService knowledgeSourceService) {
        this.knowledgeSourceService = knowledgeSourceService;
    }

    /**
     * 批量更新知识库绑定
     */
    @PostMapping("/addOrUpdate")
    public Result<Void> addOrUpdateByBatch(@RequestBody AddKnowledgeSourceDTO addKnowledgeSourceDTO) {
        knowledgeSourceService.addOrUpdateByBatch(addKnowledgeSourceDTO);
        return Result.success();
    }

}
